Skip to main content

Time Functions

Seconds

Calculates the current time in seconds:
Syntax:     Seconds()

Example: Seconds()*1000Time in milliseconds
Seconds()/60Converts seconds to minutes
IfThenElse(Seconds() > 3600, 'Hour passed', 'Still running')

Minutes

Calculates the current time in minutes:
Syntax:     Minutes()

Example: Minutes()*60Converts minutes to seconds
IfThenElse(Minutes() > 30, 'More than 30 mins', 'Less than 30 mins')

Hours

Calculates the current time in hours:
Syntax:     Minutes()

Example: Hours()*60Converts hours to minutes
IfThenElse(Hours() >= 24, 'Day passed', 'Less than a day')

Days

Calculates the current time in days:
Syntax:     Days()

Example: Days()*24Converts days to hours
Days()/7Converts days to weeks

Weeks

Calculates the current time in weeks:
Syntax:     Weeks()

Example: Weeks()*7Converts weeks to days

Months

Calculates the current time in months:
Syntax:     Months()

Example: Months()/12Converts months to years

Years

Calculates the current time in years:
Syntax:     Years()

Example: Years()*12Converts years to months
Years()*365Converts years to days

Time

Calculates the exact current time (including units):
Syntax:     Time()

Example: Time() - TimeStart()Calculates the elapsed time since the start of the simulation
TimeEnd() - Time()Calculates the remaining time until the end of the simulation

TimeStart

Calculates the exact current time:
Syntax:     TimeStart()

Example: Time() - TimeStart()Calculates the elapsed time since the start of the simulation
TimeEnd() - Time()Calculates the remaining time until the end of the simulation

TimeStep

Defines a time interval for time-based functions:
Syntax:     TimeStep()

Example: TimeLength() / TimeStep()Number of time steps

TimeLength

Calculates the duration of a time period:
Syntax:     TimeLength()

Example: (Time() - TimeStart()) / TimeLength()Calculates the elapsed time of the simulation as a percentage

TimeEnd

Defines an endpoint of a time period:
Syntax:     TimeEnd()

Example: TimeStart() + TimeLength() = TimeEnd()

Seasonal

Models seasonality using a sine wave:
Syntax:     Seasonal(Peak=0)

Example: Seasonal({9 Months}) * 0.5 + 1Peak in September
Seasonal({3 Months}) + Seasonal({9 Months})Two seasonal peaks